package com.trussell.genesis.editor;

import com.jme.math.Vector3f;
import com.jme.scene.Node;
import com.jmex.terrain.TerrainBlock;

public class Tile extends Node {

	private static final int tileSize = 16;
	
	private static final int scale = 5;
	
	int x,y; //tile indices
	private TerrainBlock tBlock;
	
	public Tile(int x, int y) {
		this.x = x;
		this.y = y;
		
		TerrainBlock tb = new TerrainBlock("tblock", 32, new Vector3f(scale,1,scale), new float[32*32], new Vector3f(0,0,0));
		attachChild(tb);
	}
	
	public Vector3f getCenter() {
		return new Vector3f(getLocalTranslation().x + (tileSize*scale),
				getLocalTranslation().y + 10,
				getLocalTranslation().z + (tileSize*scale));
	}
	
	public static Vector3f getCenter(int x, int y) {
		return new Vector3f((float)(x*tileSize*scale + tileSize*scale),
				0,
				y*tileSize*scale + tileSize*scale);
	}
	
	public Vector3f properTranslation() {
		return new Vector3f(tileSize*x*scale, 0, tileSize*y*scale);
	}
}
